<include file="Public:header"/>
<div class="cat">
<input type="button" value="添加广告位" style="padding:5px" onclick="add()">
<table bordercolor="#DDDFFF" border="1" width="100%" style="border-collapse: collapse" cellpadding="3">
	<tr height="17" align="center">
		<td class="title" width="200">id</td>
		<td class="title" width="200">位置</td>
		<td class="title" width="100">类型</td>
		<td class="title" width="200">查看广告</td>
		<td class="title" width="200">添加广告</td>
		<td class="title" width="40">修改</td>
		<td class="title" width="40"></td>
		<td class="title">　</td>
	</tr>
<volist name="place" id="place">
	<tr height="20" bgcolor="#F1F5FA" class="cat_list">
		<td width="200" style="font-weight:bold">{$place.place_tag}</td>
		<td width="200" style="font-weight:bold">{$place.place_name}</td>
		<td width="100" align="center">
<switch name="place.type">
    <case value="1">文字</case>
    <case value="2">图片</case>
	<case value="3">flash</case>
	<case value="4">代码</case>
</switch>
        </td>
		<td width="200" align="center">
		     <a href="javascript:;" onclick="view_ads('{$place.place_tag}','{$place.place_name}')">查看</a>
		</td>
		<td width="200" align="center">
		     <a href="javascript:;" onclick="add_ads('{$place.place_tag}','{$place.type}')">添加广告</a>
		</td>
		<td width="40" align="center"><a href="javascript:;" onclick="update({$place.place_id})">修改</a></td>
		<td width="40" align="center"><a href="javascript:;" onclick="deletes({$place.place_id})"></a></td>
		<td></td>
	</tr>
</volist>
</table>
</div>

<script>
function deletes(t){
    var gid=t;
	if(confirm('你确认删除此广告位吗？')) {
       $.ajax({
	       type:"GET",
		   url:"__URL__/remove",
		   dataType:"json",
		   data:{"gid":gid},
		   success:function(data){
               if(data=='1'){
				   jSuccess("<strong>删除成功！</strong>",{TimeShown : 500,VerticalPosition : 'center',HorizontalPosition : 'center',onClosed:function(){location.reload();}})
			  }else{
			      jError("<strong>删除失败!请重试</strong>",{VerticalPosition : 'center',HorizontalPosition : 'center'});
			 }
		   }
	   })

	}
}
</script>
<script src="__APP__/statics/webox/webox.js"></script>
<link href="__APP__/statics/webox/jquery-webox.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function add(){
		$.webox({
		    scroll:'no',
			height:200,
			width:950,
			bgvisibel:true,
			title:'添加广告位',
			iframe:'__URL__/add/'+Math.random
		});
}
function view_ads(t,m){
		$.webox({
			height:465,
			width:950,
			bgvisibel:true,
			title:m+'广告',
			iframe:'__URL__/ad/?place_tag='+t
		});
}
function add_ads(t,m){
		$.webox({
			height:465,
			width:950,
			bgvisibel:true,
			title:'添加广告',
			iframe:'__URL__/add_ad/?place_tag='+t+'&type='+m
		});
}
function update(t){
       var gid=t;
		$.webox({
		    scroll:'no',
			height:300,
			width:950,
			bgvisibel:true,
			title:'修改',
			iframe:'__URL__/place_edit/?id='+gid
		});
}
</script>
